/*
 * www.qwfys.com Inc.
 * Copyright (c) 2004- 2020 All Rights Reserved.
 */

package com.example.demo.controller;

import com.example.demo.ai.MessageSearchAi1;
import com.example.demo.ai.MessageSearchAi2;
import com.example.demo.ao.MessageAddAo;
import com.example.demo.ao.MessageViewAo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author lwk
 * @version MessageController, v 0.1 6/4/20 5:20 PM lwk
 */
@Api(tags = "dph/留言管理")
@RestController
public class MessageController {

    @ApiOperation(value = "添加留言", httpMethod = "POST")
    @PostMapping("messages/add")
    public void add(MessageAddAo messageAo) {
        System.out.println(messageAo);
    }

    @ApiOperation(value = "获取留言列表1", httpMethod = "POST")
    @PostMapping("messages/findAll1")
    public List<MessageViewAo> list(MessageSearchAi1 messageSearchAi) {
        ArrayList<MessageViewAo> viewAos = new ArrayList<>();
        MessageViewAo ao = new MessageViewAo(Long.valueOf(20), "lwk", "13868067829", "qwfys200@qq.com", "hfadhfdsajfd", LocalDateTime.now());
        viewAos.add(ao);
        return viewAos;
    }

    @ApiOperation(value = "获取留言列表2", httpMethod = "POST")
    @PostMapping("messages/findAll2")
    public List<MessageViewAo> list(MessageSearchAi2 messageSearchAi) {
        ArrayList<MessageViewAo> viewAos = new ArrayList<>();
        MessageViewAo ao = new MessageViewAo(Long.valueOf(20), "lwk", "13868067829", "qwfys200@qq.com", "hfadhfdsajfd", LocalDateTime.now());
        viewAos.add(ao);
        return viewAos;
    }
}
